/*
 * @Description: 
 * @Author: WuShiKang
 * @Date: 2021-04-06 15:42:47
 * @LastEditors: WuShiKang
 * @LastEditTime: 2021-04-07 16:56:21
 */
import axios,{get,post} from '@/utils/request.js'
// import {post} from '@/utils/request.js'
// 资讯分类
export default {
  namespaced:true,
  state:{
    categoryData:[]
  },
  getters:{},
  mutations:{
    changeCategoryData(state,payload){
      state.categoryData = payload;
    }
  },
  actions:{
    async findAllCategory({commit}){
      let res = await axios.get('/category/findAll');
      commit('changeCategoryData',res.data);

    },
    async saveOrUpdataCategory({dispatch},payload){
     let res =  await post('/category/saveOrUpdate',payload);
    //  console.log(res);
      // let res = await post('/category/saveOrUpdate',payload)
      return res;
    },
   async deleteById(store,payload){
      return await get('/category/saveOrUpdate',payload);
    }
  }
}
